<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_add_table_ci_post extends CI_Migration {

  public function up()
  {
    // Drop table 'ci_option' if it exists   
    $this->dbforge->drop_table('ci_postmeta');

    // Table structure for table 'ci_option'
    $this->dbforge->add_field(array(
      'pme_id' => array(
        'type' => 'INT',
        'constraint' => '11',
        'unsigned' => TRUE,
        'auto_increment' => TRUE
      ),
      'pme_key' => array(
        'type' => 'VARCHAR',
        'constraint' => '255'
      ),
      'pme_value' => array(
        'type' => 'VARCHAR',
        'constraint' => '255'
      ),
      'pme_pos_id' => array(
        'type' => 'INT',
        'constraint' => '11'
      )
    ));
    $this->dbforge->add_key('pme_id', TRUE);
    $this->dbforge->create_table('ci_postmeta');


    // Drop table 'ci_login_attempts' if it exists   
    $this->dbforge->drop_table('ci_post');

    // Table structure for table 'ci_login_attempts'
     $this->dbforge->add_field(array(
      'pos_id' => array(
        'type' => 'INT',
        'constraint' => '11',
        'unsigned' => TRUE,
        'auto_increment' => TRUE
      ),
      'pos_title' => array(
        'type' => 'VARCHAR',
        'constraint' => '255'
      ),
      'pos_content' => array(
        'type' => 'TEXT'
      ),
      'pos_url' => array(
        'type' => 'VARCHAR',
        'constraint' => '255'
      ),
      'pos_cat_id' => array(
        'type' => 'INT',
        'constraint' => '11',

       ),
      'pos_comment_status' => array(
        'type' => 'TINYINT',
        'constraint' => '1'
       ),
      'pos_update_date' => array(
        'type' => 'DATETIME'
       ),
      'pos_status' => array(
        'type' => 'TINYINT',
        'constraint' => '1'
      ),
       'pos_type' => array(
        'type' => 'VARCHAR',
        'constraint' => '255'
      ),
       'pos_view' => array(
        'type' => 'INT',
        'constraint' => '11'
      ),
       'pos_usr_ip' => array(
        'type' => 'VARCHAR',
        'constraint' => '45'
      ),
       'pos_usr_id' => array(
        'type' => 'MEDIUMINT',
        'constraint' => '8'
      ),
       'pos_cr_date' => array(
        'type' => 'DATETIME'
      ),
       'pos_lu_date' => array(
        'type' => 'DATETIME'  
      ),
       'pos_lu_uid' => array(
        'type' => 'INT',
        'constraint' => '11'
       ),
       'pos_comment_cout' => array(
        'type' => 'INT',
        'constraint' => '11'

        )
    ));
    $this->dbforge->add_key('pos_id', TRUE);
    $this->dbforge->create_table('ci_post');


    
  }
  public function down()
  {
    $this->dbforge->drop_table('ci_postmeta');
    $this->dbforge->drop_table('ci_post');
  }

}